﻿using System;
using System.Threading;

namespace 历史记录.Helper
{
    public abstract class DisposableBase : IDisposable
    {
        private int disposedValue;

        protected abstract void OnDispose();

        public void Dispose()
        {
            if (Interlocked.CompareExchange(ref disposedValue, 1, 0) == 0)
                OnDispose();
        }
    }
}